<?php
$this->load->view("header");
?>
<div id="main_content">
<div class="titlebar"><?= $title;?></div>
<div class="userdetail">
    <?php if($activetab=="bookshop"){?>
    店名：<?php if($user->shopname!=null) echo $user->shopname; else echo $user->id."的书店"?><br>
    <?php }else{?>
    <a href="<?=site_url()?>/bookiki/enterShop?id=<?=$user->id?>&go=yes" >店名：<?php if($user->shopname!=null) echo $user->shopname; else echo $user->id."的书店"?></a><br>
    <?php } ?>
    店主：<?=$user->id?>&nbsp;&nbsp;<?php echo $school.$campus?>校区&nbsp;&nbsp;积分：<?=$user->money?><br>
    求购书籍：<?=$user->numwanted?>本&nbsp;&nbsp;&nbsp;
    买到书籍：<?=$user->numwanteddeals?>本&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
    出售书籍：<?=$user->numsales?>本&nbsp;&nbsp;&nbsp;
    售出书籍：<?=$user->numsaledeals?>本<br>
    <a href="<?=site_url()?>/user/edit_msg?receiver=<?=urlencode($user->id)?>&go=yes">发站内信</a>&nbsp;&nbsp;&nbsp;
    <?php if($contact=="none"){?>
    <a href="<?=site_url()?>/bookiki/enterShop?id=<?=$user->id?>&contact=yes">联系方式</a>
    <?php }else{?>
    手机:<?=$user->phone?>
    email:<?=$user->email?>
    QQ:<?=$user->qq?>
    <?php } ?>
</div>


<div class="top-margin"></div>
<hr>

<div class="homepage_mid_column">
<div class="book_charts_noborder" style="width:400px">
 <?php if($activetab=="bookshop"){?>
<div class="book_chart_title">出售二手书</div>
<?php }else{?>
<div class="book_chart_title"><?=$user->id?>卖的书我可能需要：</div>
<?php } ?>
<table class="chart_listing_preview">
<tbody>
<?php
if($saleposts==null){
  if($activetab=="bookshop") 
  echo "这个书店暂时没有二手书出售。";
 else
  echo "我想买的书店主可能没有";
}
else{
  foreach($saleposts as $salepost){?>
  <table id="book_item" cellspacing="0" cellpadding="0" class="BookItem" onmouseover="this.style.background = &quot;#f2f3f4&quot;;" onmouseout="this.style.background = &quot;#ffffff&quot;;" >
  <tbody>
  <tr class="tr-margin"><td></tr>
  <tr>
    <td valign="top" align="left">
        <table class="BookInfo" cellspacing="0" cellpadding="0" width="100&percnt;">
        <tbody><tr><td class="title"  align="left" style="font-size:13px"><a href="<?=site_url()?>/post/salepost_detail?userid=<?=$salepost->user_id?>&bookid=<?=$salepost->book_id?>" name="landingpagelink"><?=$salepost->book_title?></a></td></tr>
        <tr><td class="tracks" colspan="10" align="left" style="font-size:12px">要价:￥<?=$salepost->price?>&nbsp;&nbsp;&nbsp;
        成色:<?php switch($salepost->quality) {case 1: echo "较旧";break; case 2: echo "半新";break; case 3: echo "基本全新";break; case 4: echo "全新";break; }?>
         <?php $content=$salepost->book_title;
                   $receiver=$salepost->user_id;
        ?>
        <a href="<?=site_url()?>/user/edit_msg?content=<?=$content?>&type=wanted&receiver=<?=$receiver?>&go=yes">站短</a>
         </td></tr>
         </tbody></table>
    </td>
   </tr>
   </tbody>
   </table>

<?php
 } //end of foreach
} //end of else
?>
</tbody>
</table>
</div><!--book_charts中间偏左的排行榜-->

<div class="book_charts" style="width:400px">
 <?php if($activetab=="bookshop"){?>
<div class="book_chart_title">求购二手书</div>
<?php }else{?>
<div class="book_chart_title"><?=$user->id?>求购的书我可能有：</div>
<?php } ?>
<table class="chart_listing_preview">
<tbody>
<?php
if($wantedposts==null){
  if($activetab=="bookshop")
  echo "这个书店暂时不求购二手书。";
 else
  echo "我想卖的书店主可能不需要";
}
else{
  foreach($wantedposts as $wantedpost){?>
  <table id="book_item" cellspacing="0" cellpadding="0" class="BookItem" onmouseover="this.style.background = &quot;#f2f3f4&quot;;" onmouseout="this.style.background = &quot;#ffffff&quot;;" >
  <tbody>
  <tr class="tr-margin"><td></tr>
  <tr>
    <td valign="top" align="left">
        <table class="BookInfo" cellspacing="0" cellpadding="0" width="100&percnt;">
        <tbody><tr><td class="title"  align="left" style="font-size:13px"><a href="<?=site_url()?>/post/wantedpost_detail?userid=<?=$wantedpost->user_id?>&bookid=<?=$wantedpost->book_id?>" name="landingpagelink"><?=$wantedpost->book_title?></a></td></tr>
        <tr><td class="tracks" colspan="10" align="left" style="font-size:12px">可接受价格：￥<?=$wantedpost->start_price?>-￥<?=$wantedpost->end_price?>&nbsp;&nbsp;
        <?php $content=$wantedpost->book_title;
                   $receiver=$wantedpost->user_id;
        ?>
        <a href="<?=site_url()?>/user/edit_msg?content=<?=$content?>&type=sale&receiver=<?=$receiver?>&go=yes">站短</a>
        </td></tr>
         </tbody>
         </table>
    </td>
   </tr>
   </tbody>
   </table>

<?php
 } //end of foreach
} //end of else
?>
</tbody>
</table>
</div><!--book_charts中间偏左的排行榜-->

</div><!--homepage_mid_column-->

<?php
$this->load->view("footer");
?>


